version 14.2
set more off

***************************************************************************************************************************
* THIS ROUTINE GENERATES FIGURES II AND III OF WASEEM (2020) ROLE OF WITHHOLDING ... 
***************************************************************************************************************************

/* PHASED ADOPTION OF VAT IN PAKISTAN */
*--------------------------------------

use 			"$project_data\EvolutionRPs_Quarter_Sector_v1.dta", clear
drop			if quarter>=194
replace			numbfirms=numbfirms/1000
replace			numbfirmspos=numbfirmspos/1000
replace			numbfirmssector=numbfirmssector/1000
replace			numbfirmsecpos=numbfirmsecpos/1000
#d				;
twoway  		(line  numbfirms quarter,sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmspos quarter if nilreturn==0,sort lwidth(thick) lcolor(red)),
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				xtitle("Quarter of the Year") xscale(titlegap(*10)) ylabel(0(20)100)
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Aggregate.eps", replace;
#d				cr

* MANUFACTURERS

local			s=1
#d;
twoway		  	(line  numbfirmssector quarter if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos quarter if nilreturn==0 & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(146, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Sector`s'.eps", replace;
#d 				cr
				
* IMPORTERS

local			s=2
#d;
twoway		  	(line  numbfirmssector quarter if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos quarter if nilreturn==0 & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(150, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Sector`s'.eps", replace;
#d 				cr

* DISTRIBUTORS, WHOLESALERS & RETAILERS

local			s=4
#d;
twoway		  	(line  numbfirmssector quarter if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos quarter if nilreturn==0 & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(154, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Sector`s'.eps", replace;
#d 				cr

* SERVICE PROVIDERS

local			s=5
#d;
twoway		  	(line  numbfirmssector quarter if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos quarter if nilreturn==0 & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(162, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Sector`s'.eps", replace;
#d 				cr

* ENERGY SECTOR

local			s=6
#d;
twoway		  	(line  numbfirmssector quarter if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos quarter if nilreturn==0 & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(158, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EvolutionRPs_Sector`s'.eps", replace;
#d 				cr
				
				
/* ENTRY OF FIRMS */
*------------------

use 			"$project_data\EntryRPs_Quarter_Sector_v1.dta", clear
drop			if entryq>=194
drop			if entryposq>=194
replace			numbfirms=numbfirms/1000
replace			numbfirmspos=numbfirmspos/1000
replace			numbfirmssector=numbfirmssector/1000
replace			numbfirmsecpos=numbfirmsecpos/1000
#d				;
twoway  		(line  numbfirms entryq,sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmspos entryposq if entryposq!=.,sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10))
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph			 export "$project_output\EntryRPs_Aggregate.eps", replace;
#d				cr

* MANUFACTURERS

local	 		s=1
#d				;
twoway  		(line  numbfirmssector entryq if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos entryposq if entryposq!=. & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(146, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EntryRPs_Sector`s'.eps", replace;
#d				cr


* IMPORTERS

local	 		s=2
#d				;
twoway  		(line  numbfirmssector entryq if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos entryposq if entryposq!=. & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(150, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EntryRPs_Sector`s'.eps", replace;
#d				cr


* DISTRIBUTORS, WHOLESALERS & RETAILERS

local	 		s=4
#d				;
twoway  		(line  numbfirmssector entryq if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos entryposq if entryposq!=. & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(154, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EntryRPs_Sector`s'.eps", replace;
#d				cr


* SERVICE PROVIDERS

local	 		s=5
#d				;
twoway  		(line  numbfirmssector entryq if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos entryposq if entryposq!=. & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(162, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EntryRPs_Sector`s'.eps", replace;
#d				cr


* ENERGY SECTOR

local	 		s=6
#d				;
twoway  		(line  numbfirmssector entryq if sector==`s',sort lwidth(thick) lcolor(midblue) lpattern(shortdash))
				(line  numbfirmsecpos entryposq if entryposq!=. & sector==`s',sort lwidth(thick) lcolor(red)),
				xtitle("Quarter of the Year") xscale(titlegap(*10)) xline(158, lpatter(dash) lcolor(green)) 
				xlabel(130 "92" 138 "94" 146 "96" 154 "98" 162 "00" 170 "02" 178 "04" 186 "06" 194 "08")
				ytitle(Number of Firms (000s), alignment(bottom)) yscale(r(0))  yscale(titlegap(*10))
				legend(region(style(none)) label(1 "All Firms") label(2 "Active Firms") rows(1) order(2 1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 0 0 2)) bgcolor(white); 	
graph 			export "$project_output\EntryRPs_Sector`s'.eps", replace;
#d				cr


